/*
 * @Author: liu.lin liu.lin@hzleaper.com
 * @Date: 2024-03-26 17:20:20
 * @LastEditors: liu.lin liu.lin@hzleaper.com
 * @LastEditTime: 2024-03-26 17:24:26
 * @FilePath: \nest_temp\src\test.interceptor.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
  CallHandler,
  ExecutionContext,
  Injectable,
  NestInterceptor,
} from '@nestjs/common';
import { Observable, map } from 'rxjs';
import { Reflector } from '@nestjs/core';
@Injectable()
export class TestInterceptor implements NestInterceptor {
  constructor(private readonly reflector: Reflector) {}
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    return next.handle().pipe(
      map((data: any) => {
        return {
          code: 200,
          data,
        };
      }),
    );
  }
}

